import subprocess

class ResolutionDetector:
    def detect(self):
        try:
            output = subprocess.check_output(["xrandr"], text=True)
            for line in output.splitlines():
                if " connected" in line:
                    res = re.search(r'(\d+)x(\d+)', line)
                    if res:
                        return (int(res.group(1)), int(res.group(2)))
        except:
            return (1024, 768)

class LayoutAdaptor:
    def adapt(self, resolution):
        width, height = resolution
        if width / height > 1.6:
            return "wide"
        else:
            return "default"